.class public Lrexsee/barcode/ViewfinderView;
.super Landroid/view/View;
.source "ViewfinderView.java"


# static fields
.field private static final ANIMATION_DELAY:J = 0x64L

.field private static final OPAQUE:I = 0xff

.field private static final SCANNER_ALPHA:[I


# instance fields
.field private lastPossibleResultPoints:Ljava/util/Collection;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Collection",
            "<",
            "Lcom/google/zxing/ResultPoint;",
            ">;"
        }
    .end annotation
.end field

.field private final mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

.field private final paint:Landroid/graphics/Paint;

.field private possibleResultPoints:Ljava/util/Collection;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Collection",
            "<",
            "Lcom/google/zxing/ResultPoint;",
            ">;"
        }
    .end annotation
.end field

.field private resultBitmap:Landroid/graphics/Bitmap;

.field private scannerAlpha:I


# direct methods
.method static constructor <clinit>()V
    .locals 6

    .prologue
    const/16 v5, 0xc0

    const/16 v4, 0x80

    const/16 v3, 0x40

    .line 21
    const/16 v0, 0x8

    new-array v0, v0, [I

    const/4 v1, 0x1

    aput v3, v0, v1

    const/4 v1, 0x2

    aput v4, v0, v1

    const/4 v1, 0x3

    aput v5, v0, v1

    const/4 v1, 0x4

    const/16 v2, 0xff

    aput v2, v0, v1

    const/4 v1, 0x5

    aput v5, v0, v1

    const/4 v1, 0x6

    aput v4, v0, v1

    const/4 v1, 0x7

    aput v3, v0, v1

    sput-object v0, Lrexsee/barcode/ViewfinderView;->SCANNER_ALPHA:[I

    .line 15
    return-void
.end method

.method public constructor <init>(Lrexsee/barcode/BarcodeCaptureDialog;)V
    .locals 2
    .param p1, "dialog"    # Lrexsee/barcode/BarcodeCaptureDialog;

    .prologue
    .line 34
    invoke-virtual {p1}, Lrexsee/barcode/BarcodeCaptureDialog;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p0, v0}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    .line 26
    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    .line 28
    const/4 v0, 0x0

    iput v0, p0, Lrexsee/barcode/ViewfinderView;->scannerAlpha:I

    .line 30
    new-instance v0, Ljava/util/HashSet;

    const/4 v1, 0x5

    invoke-direct {v0, v1}, Ljava/util/HashSet;-><init>(I)V

    iput-object v0, p0, Lrexsee/barcode/ViewfinderView;->possibleResultPoints:Ljava/util/Collection;

    .line 35
    iput-object p1, p0, Lrexsee/barcode/ViewfinderView;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    .line 36
    return-void
.end method


# virtual methods
.method public addPossibleResultPoint(Lcom/google/zxing/ResultPoint;)V
    .locals 1
    .param p1, "point"    # Lcom/google/zxing/ResultPoint;

    .prologue
    .line 105
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->possibleResultPoints:Ljava/util/Collection;

    invoke-interface {v0, p1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z

    .line 106
    return-void
.end method

.method public drawResultBitmap(Landroid/graphics/Bitmap;)V
    .locals 0
    .param p1, "barcode"    # Landroid/graphics/Bitmap;

    .prologue
    .line 101
    iput-object p1, p0, Lrexsee/barcode/ViewfinderView;->resultBitmap:Landroid/graphics/Bitmap;

    .line 102
    invoke-virtual {p0}, Lrexsee/barcode/ViewfinderView;->invalidate()V

    .line 103
    return-void
.end method

.method public drawViewfinder()V
    .locals 1

    .prologue
    .line 97
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/barcode/ViewfinderView;->resultBitmap:Landroid/graphics/Bitmap;

    .line 98
    invoke-virtual {p0}, Lrexsee/barcode/ViewfinderView;->invalidate()V

    .line 99
    return-void
.end method

.method public onDraw(Landroid/graphics/Canvas;)V
    .locals 14
    .param p1, "canvas"    # Landroid/graphics/Canvas;

    .prologue
    .line 40
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    iget-object v9, v0, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRect:Landroid/graphics/Rect;

    .line 41
    .local v9, "frame":Landroid/graphics/Rect;
    if-nez v9, :cond_0

    .line 95
    :goto_0
    return-void

    .line 42
    :cond_0
    invoke-virtual {p1}, Landroid/graphics/Canvas;->getWidth()I

    move-result v13

    .line 43
    .local v13, "width":I
    invoke-virtual {p1}, Landroid/graphics/Canvas;->getHeight()I

    move-result v10

    .line 46
    .local v10, "height":I
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const/16 v1, 0x7f

    const/4 v2, 0x0

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Paint;->setARGB(IIII)V

    .line 47
    const/4 v1, 0x0

    const/4 v2, 0x0

    int-to-float v3, v13

    iget v0, v9, Landroid/graphics/Rect;->top:I

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 48
    const/4 v1, 0x0

    iget v0, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v0

    iget v0, v9, Landroid/graphics/Rect;->left:I

    int-to-float v3, v0

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 49
    iget v0, v9, Landroid/graphics/Rect;->right:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v1, v0

    iget v0, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v0

    int-to-float v3, v13

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 50
    const/4 v1, 0x0

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v2, v0

    int-to-float v3, v13

    int-to-float v4, v10

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 52
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->resultBitmap:Landroid/graphics/Bitmap;

    if-eqz v0, :cond_1

    .line 54
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const/16 v1, 0xff

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAlpha(I)V

    .line 55
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->resultBitmap:Landroid/graphics/Bitmap;

    iget v1, v9, Landroid/graphics/Rect;->left:I

    int-to-float v1, v1

    iget v2, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v2

    iget-object v3, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    goto :goto_0

    .line 59
    :cond_1
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const/high16 v1, -0x1000000

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 60
    iget v0, v9, Landroid/graphics/Rect;->left:I

    int-to-float v1, v0

    iget v0, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v0

    iget v0, v9, Landroid/graphics/Rect;->right:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v3, v0

    iget v0, v9, Landroid/graphics/Rect;->top:I

    add-int/lit8 v0, v0, 0x2

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 61
    iget v0, v9, Landroid/graphics/Rect;->left:I

    int-to-float v1, v0

    iget v0, v9, Landroid/graphics/Rect;->top:I

    add-int/lit8 v0, v0, 0x2

    int-to-float v2, v0

    iget v0, v9, Landroid/graphics/Rect;->left:I

    add-int/lit8 v0, v0, 0x2

    int-to-float v3, v0

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    const/4 v4, 0x1

    sub-int/2addr v0, v4

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 62
    iget v0, v9, Landroid/graphics/Rect;->right:I

    const/4 v1, 0x1

    sub-int/2addr v0, v1

    int-to-float v1, v0

    iget v0, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v0

    iget v0, v9, Landroid/graphics/Rect;->right:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v3, v0

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    const/4 v4, 0x1

    sub-int/2addr v0, v4

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 63
    iget v0, v9, Landroid/graphics/Rect;->left:I

    int-to-float v1, v0

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    const/4 v2, 0x1

    sub-int/2addr v0, v2

    int-to-float v2, v0

    iget v0, v9, Landroid/graphics/Rect;->right:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v3, v0

    iget v0, v9, Landroid/graphics/Rect;->bottom:I

    add-int/lit8 v0, v0, 0x1

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 66
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const/high16 v1, -0x10000

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 67
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    sget-object v1, Lrexsee/barcode/ViewfinderView;->SCANNER_ALPHA:[I

    iget v2, p0, Lrexsee/barcode/ViewfinderView;->scannerAlpha:I

    aget v1, v1, v2

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAlpha(I)V

    .line 68
    iget v0, p0, Lrexsee/barcode/ViewfinderView;->scannerAlpha:I

    add-int/lit8 v0, v0, 0x1

    sget-object v1, Lrexsee/barcode/ViewfinderView;->SCANNER_ALPHA:[I

    array-length v1, v1

    rem-int/2addr v0, v1

    iput v0, p0, Lrexsee/barcode/ViewfinderView;->scannerAlpha:I

    .line 69
    invoke-virtual {v9}, Landroid/graphics/Rect;->height()I

    move-result v0

    div-int/lit8 v0, v0, 0x2

    iget v1, v9, Landroid/graphics/Rect;->top:I

    add-int v11, v0, v1

    .line 70
    .local v11, "middle":I
    iget v0, v9, Landroid/graphics/Rect;->left:I

    add-int/lit8 v0, v0, 0x2

    int-to-float v1, v0

    const/4 v0, 0x1

    sub-int v0, v11, v0

    int-to-float v2, v0

    iget v0, v9, Landroid/graphics/Rect;->right:I

    const/4 v3, 0x1

    sub-int/2addr v0, v3

    int-to-float v3, v0

    add-int/lit8 v0, v11, 0x2

    int-to-float v4, v0

    iget-object v5, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 72
    iget-object v8, p0, Lrexsee/barcode/ViewfinderView;->possibleResultPoints:Ljava/util/Collection;

    .line 73
    .local v8, "currentPossible":Ljava/util/Collection;, "Ljava/util/Collection<Lcom/google/zxing/ResultPoint;>;"
    iget-object v7, p0, Lrexsee/barcode/ViewfinderView;->lastPossibleResultPoints:Ljava/util/Collection;

    .line 74
    .local v7, "currentLast":Ljava/util/Collection;, "Ljava/util/Collection<Lcom/google/zxing/ResultPoint;>;"
    invoke-interface {v8}, Ljava/util/Collection;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_4

    .line 75
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/barcode/ViewfinderView;->lastPossibleResultPoints:Ljava/util/Collection;

    .line 85
    :cond_2
    if-eqz v7, :cond_3

    .line 86
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const/16 v1, 0x7f

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAlpha(I)V

    .line 87
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const v1, -0xffff01

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 88
    invoke-interface {v7}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_1
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-nez v1, :cond_5

    .line 93
    :cond_3
    const-wide/16 v1, 0x64

    iget v3, v9, Landroid/graphics/Rect;->left:I

    iget v4, v9, Landroid/graphics/Rect;->top:I

    iget v5, v9, Landroid/graphics/Rect;->right:I

    iget v6, v9, Landroid/graphics/Rect;->bottom:I

    move-object v0, p0

    invoke-virtual/range {v0 .. v6}, Lrexsee/barcode/ViewfinderView;->postInvalidateDelayed(JIIII)V

    goto/16 :goto_0

    .line 77
    :cond_4
    new-instance v0, Ljava/util/HashSet;

    const/4 v1, 0x5

    invoke-direct {v0, v1}, Ljava/util/HashSet;-><init>(I)V

    iput-object v0, p0, Lrexsee/barcode/ViewfinderView;->possibleResultPoints:Ljava/util/Collection;

    .line 78
    iput-object v8, p0, Lrexsee/barcode/ViewfinderView;->lastPossibleResultPoints:Ljava/util/Collection;

    .line 79
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const/16 v1, 0xff

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAlpha(I)V

    .line 80
    iget-object v0, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    const v1, -0xffff01

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 81
    invoke-interface {v8}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_2
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_2

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v12

    check-cast v12, Lcom/google/zxing/ResultPoint;

    .line 82
    .local v12, "point":Lcom/google/zxing/ResultPoint;
    iget v1, v9, Landroid/graphics/Rect;->left:I

    int-to-float v1, v1

    invoke-virtual {v12}, Lcom/google/zxing/ResultPoint;->getX()F

    move-result v2

    add-float/2addr v1, v2

    iget v2, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v2

    invoke-virtual {v12}, Lcom/google/zxing/ResultPoint;->getY()F

    move-result v3

    add-float/2addr v2, v3

    const/high16 v3, 0x40c00000    # 6.0f

    iget-object v4, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    invoke-virtual {p1, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawCircle(FFFLandroid/graphics/Paint;)V

    goto :goto_2

    .line 88
    .end local v12    # "point":Lcom/google/zxing/ResultPoint;
    :cond_5
    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v12

    check-cast v12, Lcom/google/zxing/ResultPoint;

    .line 89
    .restart local v12    # "point":Lcom/google/zxing/ResultPoint;
    iget v1, v9, Landroid/graphics/Rect;->left:I

    int-to-float v1, v1

    invoke-virtual {v12}, Lcom/google/zxing/ResultPoint;->getX()F

    move-result v2

    add-float/2addr v1, v2

    iget v2, v9, Landroid/graphics/Rect;->top:I

    int-to-float v2, v2

    invoke-virtual {v12}, Lcom/google/zxing/ResultPoint;->getY()F

    move-result v3

    add-float/2addr v2, v3

    const/high16 v3, 0x40400000    # 3.0f

    iget-object v4, p0, Lrexsee/barcode/ViewfinderView;->paint:Landroid/graphics/Paint;

    invoke-virtual {p1, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawCircle(FFFLandroid/graphics/Paint;)V

    goto :goto_1
.end method
